$(function(){
  
  var wcx_fn = {};

  wcx_fn.banner = function() {
    var swiper_slide = $('.swiper-slide');
    var swiper ;
    if( swiper_slide.length > 2 ) {
      swiper = new Swiper('.swiper-container', {
        // nextButton: '.swiper-button-next',
        // prevButton: '.swiper-button-prev',
        pagination: '.swiper-pagination' ,
        loop : true,
        autoplay : 3000,
      });
    }else {
      swiper = new Swiper('.swiper-container');
    }
   
  }

  //滑动显示图片

  wcx_fn.tab = function() {
    var comIconW = $('.comIconW');
    var rescouce_contentW = $('.rescouce_contentW');
    var re_right = $('.re_right');
    comIconW.each(function(i){
      $(this).hover(function(){
        rescouce_contentW.hide();
        rescouce_contentW.eq(i).show();
        re_right.removeClass('up_active');
        re_right.eq(i).addClass('up_active')
      },function(){
      })
    })
    
  }

 
  $('.old_comW').removeClass('move_up');
  $('.old_comW').hover(function(){
    $(this).removeClass('move_up');
    // $(this).addClass('old_active');
    // $(this).find('.img_icon').addClass('img_icon_act');
  },function(){
    var _this = this;
    // $(this).removeClass('old_active');
    
   

  })

  //滚动到可视区
  var old_on = true;
  var enterBox = true;
  var resourceW = true;
  wcx_fn.scrollMove = function() {
    // old_youxi();
    // setTimeout(function(){
    //   resourceW_fn()
    //   setTimeout(function(){
    //    enterBox_fn()
    //   },2000)
    // },3000);
    $(window).scroll(function(){
       //老年人游戏
       old_youxi();
       setTimeout(function(){
         resourceW_fn();
       },1000);
       
    })
  }
 function old_youxi( ) {
    var old_bigImgW = $('.old_bigImgW');
    var  win = $(window);
    if( old_bigImgW.offset().top <= win.height() + $(document).scrollTop() && old_on ) {
      $('.old_comW').addClass('move_up');
      old_on = false;
     
    }
 }

 function enterBox_fn() {
  var enterBox = $('.enterBox');
  var  win = $(window);
  if( enterBox.offset().top <= win.height() + $(document).scrollTop()  && enterBox) {
    $('.spiltEnterBox li').addClass('move_up');
    enterBox = false;
  }
 }

 function resourceW_fn() {
  var resourceW = $('.resourceW');
  var  win = $(window);
  if( resourceW.offset().top <= win.height() + $(document).scrollTop()  && resourceW) {
    $('.re_right').addClass('move_up');
    resourceW = false;
  }
 }
  wcx_fn.init = function() {
    wcx_fn.banner();
    wcx_fn.tab();
    wcx_fn.scrollMove();
  }
  wcx_fn.init();
})

 



